package edu.purdue.cs.ds;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;


public class FileIO {

	public static ArrayList<String> readFile(String filename){

		ArrayList<String> data = new ArrayList<String>();
		File file = new File(filename);

		BufferedReader buf = null;
		try {
			buf = new BufferedReader(new FileReader(file));
		} catch (FileNotFoundException e1) {
			System.out.println("Unable to open file " + filename);
			System.exit(0);
		}

		String record = null;

		try {
			while((record = buf.readLine()) != null)
			{
				data.add(record);
			}
		} catch (IOException e) {
			System.out.println("Error Reading Data from File " + filename);
			System.exit(0);
		}

		return data;
	}
}
